package com.example.leave.domain.approval.aggregate;

import com.example.leave.domain.leave.aggregate.valueObject.LeaveType;
import lombok.Data;

/**
 * 审批规则
 *
 * @author lxh
 * @date 2020/11/25 上午9:59
 **/
@Data
public class ApprovalRule {
    private String ruleId;
    /**
     * 请假类型
     */
    private LeaveType leaveType;
    /**
     * 最长请假时长，天计
     */
    private Integer duration;
    /**
     * 最大审批层级，比如1由部门所在领导审批即可，2为当前部门的上一级部门领导审批，以此类推
     */
    private Integer maxLevel;

    public static ApprovalRule builder() {
        return new ApprovalRule();
    }

    public ApprovalRule withLeaveType(LeaveType leaveType) {
        this.setLeaveType(leaveType);
        return this;
    }

    public ApprovalRule withDuration(int duration) {
        this.setDuration(duration);
        return this;
    }
}
